﻿CREATE PROCEDURE QIC.Script @ConfigName VARCHAR(50) = NULL
AS
BEGIN

	DECLARE @InterfaceName VARCHAR(200)

	DECLARE interfaceCursor CURSOR LOCAL FAST_FORWARD FOR
	SELECT interface.InterfaceName FROM QIC.Interface_(@ConfigName) interface
	WHERE interface.SchemaName <> 'QIC'

	OPEN interfaceCursor

	WHILE (1=1)
	BEGIN
		FETCH NEXT FROM interfaceCursor INTO @InterfaceName
		IF @@FETCH_STATUS <> 0 BREAK

		EXEC QIC.ScriptInterface @InterfaceName = @InterfaceName, @ConfigName = @ConfigName

	END

	CLOSE interfaceCursor
	DEALLOCATE interfaceCursor

END